#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "userhighlighter.h"
#include "formattededitor.h"
#include <QtGui>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    createFormattedEditor();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::createFormattedEditor() {
    QVBoxLayout *newLayout = new QVBoxLayout(ui->tab_2);
    QToolBar *newToolbar = new QToolBar(ui->tab_2);

    fancyEditor = new FormattedEditor(newToolbar ,ui->tab_2);

    //add the tab, toolbar, and editor
    newLayout->addWidget(newToolbar);
    newLayout->addWidget(fancyEditor);
}
